<template>
  <!-- 成交管理=== 合同列表 -->
  <el-dialog
    title="客户列表"
    v-model="visible"
    width="50%"
    destroy-on-close
    @closed="$emit('closed')"
  >
    <el-table :data="list" style="width: 100%" border>
      <el-table-column
        label="ID"
        prop="id"
        width="70"
        :show-overflow-tooltip="true"
      ></el-table-column>
      <!-- <el-table-column
          label="报价单号"
          prop="quotesNumber"
          width="250"
        ></el-table-column> -->
      <el-table-column
        label="报价名称"
        :show-overflow-tooltip="true"
        prop="quotesName"
        min-width="250"
      >
      </el-table-column>
      <!-- <el-table-column label="合同名称" prop="contractName" min-width="200">
        </el-table-column> -->
      <el-table-column label="报价总额" prop="price" width="100">
        <template #default="scope">
          <p>{{ scope.row.price }}元</p>
        </template>
      </el-table-column>
      <el-table-column
        label="报价日期"
        prop="createTime"
        width="100"
      ></el-table-column>
      <el-table-column label="付款方式" prop="payDescription" min-width="100">
      </el-table-column>
      <el-table-column label="交货日期" prop="deliveryTime" width="120">
        <template #default="scope">
          <p>{{ scope.row.deliveryTime }}天之后</p>
        </template>
      </el-table-column>
      <el-table-column
        label="验收标准"
        prop="checkRule"
        :show-overflow-tooltip="true"
        min-width="120"
      >
      </el-table-column>
    </el-table>

    <el-pagination
      v-model:current-page="currentPage"
      small
      layout="total, prev, pager, next"
      :page-size="limit"
      :total="total"
      @current-change="handleCurrentChange"
      v-if="total > 10"
    />
  </el-dialog>
</template>

<script>
export default {
  emits: ['success', 'closed'],
  data () {
    return {
      visible: false,
      list: [],
      customerId: '',
      limit: 10,//每页条数
      page: 1,//页码
      currentPage: 1,
      pageSize: 1,
      total: 0
    }
  },

  mounted () {

  },
  methods: {
    //显示
    open (data) {
      this.visible = true
      this.customerId = data.id
      this.getList(data.id)
    },
    async getList (id) {
      let params = { customerId: this.customerId, page: this.page, limit: this.limit }
      let res = await this.$API.contract.dealManagement.getQuoteList.get(params)
      if (res.code == 200) {
        this.list = res.data
        this.total = res.total
      }
    },
    handleCurrentChange (val) {
      this.page = val
      this.getList()
    }


  }
}
</script>

<style lang='scss' scoped>
</style>
